package net.xdclass.springboot.controller;

import net.xdclass.springboot.domain.MyException;
import net.xdclass.springboot.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class ExceptionController {

    @RequestMapping("/api/v1/exception")
    public Object index(){
        int i = 1/0;
        return new User(11,"111","111",new Date());
    }

    @RequestMapping("/api/v1/myException")
    public Object index2(){
        throw new MyException("自定义异常", "100");
    }
}
